package com.bdqn.vueboot.exception;

import com.bdqn.vueboot.util.DtoUtil;
import com.bdqn.vueboot.util.ErrorCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//全局异常捕捉处理
@ControllerAdvice
public class CustomExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    @ResponseBody
    public Object handlerSellerException(RuntimeException ex) {
        return DtoUtil.returnFail(ex.getMessage(), ErrorCode.AUTH_TOKEN_INVALID);
    }
}
